package com.newjiabo.ski.service.impl;

import java.util.List;

import com.newjiabo.common.utils.DateUtils;
import com.newjiabo.common.utils.SnowFlake;
import com.newjiabo.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.newjiabo.ski.mapper.SkiOrderDetailServicesMapper;
import com.newjiabo.ski.domain.SkiOrderDetailServices;
import com.newjiabo.ski.service.ISkiOrderDetailServicesService;

/**
 * 更多服务订单详情Service业务层处理
 *
 * @author CaoMengHui
 * @date 2023-09-22
 */
@Service
public class SkiOrderDetailServicesServiceImpl implements ISkiOrderDetailServicesService {
    @Autowired
    private SkiOrderDetailServicesMapper skiOrderDetailServicesMapper;

    /**
     * 查询更多服务订单详情
     *
     * @param id 更多服务订单详情主键
     * @return 更多服务订单详情
     */
    @Override
    public SkiOrderDetailServices selectSkiOrderDetailServicesById(String id) {
        return skiOrderDetailServicesMapper.selectSkiOrderDetailServicesById(id);
    }

    /**
     * 查询更多服务订单详情列表
     *
     * @param skiOrderDetailServices 更多服务订单详情
     * @return 更多服务订单详情
     */
    @Override
    public List<SkiOrderDetailServices> selectSkiOrderDetailServicesList(SkiOrderDetailServices skiOrderDetailServices) {
        return skiOrderDetailServicesMapper.selectSkiOrderDetailServicesList(skiOrderDetailServices);
    }

    /**
     * 新增更多服务订单详情
     *
     * @param skiOrderDetailServices 更多服务订单详情
     * @return 结果
     */
    @Override
    public int insertSkiOrderDetailServices(SkiOrderDetailServices skiOrderDetailServices) {
        if(StringUtils.isEmpty(skiOrderDetailServices.getOrderDetailId())){
            skiOrderDetailServices.setId(SnowFlake.getIdStr());
        }
        skiOrderDetailServices.setCreateTime(DateUtils.getNowDate());
        skiOrderDetailServices.setDelFlag(false);
        return skiOrderDetailServicesMapper.insertSkiOrderDetailServices(skiOrderDetailServices);
    }

    /**
     * 修改更多服务订单详情
     *
     * @param skiOrderDetailServices 更多服务订单详情
     * @return 结果
     */
    @Override
    public int updateSkiOrderDetailServices(SkiOrderDetailServices skiOrderDetailServices) {
        skiOrderDetailServices.setUpdateTime(DateUtils.getNowDate());
        return skiOrderDetailServicesMapper.updateSkiOrderDetailServices(skiOrderDetailServices);
    }

    /**
     * 批量删除更多服务订单详情
     *
     * @param ids 需要删除的更多服务订单详情主键
     * @return 结果
     */
    @Override
    public int deleteSkiOrderDetailServicesByIds(String[] ids) {
        return skiOrderDetailServicesMapper.deleteSkiOrderDetailServicesByIds(ids);
    }

    /**
     * 删除更多服务订单详情信息
     *
     * @param id 更多服务订单详情主键
     * @return 结果
     */
    @Override
    public int deleteSkiOrderDetailServicesById(String id) {
        return skiOrderDetailServicesMapper.deleteSkiOrderDetailServicesById(id);
    }

    @Override
    public int insertBatch(List<SkiOrderDetailServices> orderDetailServicesList) {
        return skiOrderDetailServicesMapper.insertBatch(orderDetailServicesList);
    }

    @Override
    public List<SkiOrderDetailServices> selectByOrderDetailId(String orderDetailId) {
        return skiOrderDetailServicesMapper.selectByOrderDetailId(orderDetailId);
    }
}
